package com.bsj.pay.task;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.bsj.pay.config.GlobalConfig;
import com.bsj.pay.service.OrderService;

@Component
public class QueryOrderTask {
	
	@Autowired
	private OrderService orderService;
	
	private static boolean isReturn=true;

	@Scheduled(fixedRate = 1000)
	public void execute() {
		try {
			if(QueryOrderTask.isReturn&&GlobalConfig.isInit)
			{
				QueryOrderTask.isReturn=false;
				orderService.QueryOrderTask();
				QueryOrderTask.isReturn=true;
			}
		} catch (Exception e) {
			QueryOrderTask.isReturn=true;
		}
	}
}
